{{ extend "base.html" }}

{{ block ex_navigation }} 
<li>&gt;&gt;</li>
<li><a href="/admin/uploadphoto/">{{=_("Add Photos") }}</a> </li>
{{ end }}

{{ block commandbar }}

{{ end }}

{{ block head_ex }}
<link href="{{=url_for_static('swfupload/swfupload_style.css')}}" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="{{=url_for_static('swfupload/swfupload.js')}}"></script>
<script type="text/javascript" src="{{=url_for_static('swfupload/swfupload.queue.js')}}"></script>
<script type="text/javascript" src="{{=url_for_static('swfupload/fileprogress.js')}}"></script>
<script type="text/javascript" src="/localjavascript/handlers.js"></script>
<script type="text/javascript">
		var swfu;

		window.onload = function() {
			var settings = {
				flash_url : "{{=url_for_static('swfupload/swfupload.swf')}}",
				upload_url: "/admin/uploadphoto/",
				file_size_limit : "1 MB",
				file_types : "*.jpg;*.png;*.gif;*.jpeg;*.tiff;*.ico;*.bmp;*.jpe;*.JPG;*.PNG;*.GIF;*.JPEG;*.TIFF;*.ICO;*.BMP;*.JPE",
				file_types_description : "Web Image Files",
				file_upload_limit : 100,
				file_queue_limit : 0,
				custom_settings : {
					progressTarget : "fsUploadProgress",
					cancelButtonId : "btnCancel"
				},
				post_params: {"owner" : "{{=users.get_current_user().nickname()}}"},
				debug: false,

				// Button settings
				button_image_url: "{{=url_for_static('swfupload/button_image.png')}}",
				button_width: "120",
				button_height: "29",
				button_placeholder_id: "spanButtonPlaceHolder",
				button_text: '<span class="size12">{{=_("Select Photos") }}</span>',
				button_text_style: ".size16 { font-size: 12; }",
				button_text_left_padding: 20,
				button_text_top_padding: 5,
				
				// The event handler functions are defined in handlers.js
				file_dialog_start_handler: fileDialogStart,
				file_queued_handler : fileQueued,
				file_queue_error_handler : fileQueueError,
				file_dialog_complete_handler : fileDialogComplete,
				upload_start_handler : uploadStart,
				upload_progress_handler : uploadProgress,
				upload_error_handler : uploadError,
				upload_success_handler : uploadSuccess,
				upload_complete_handler : uploadComplete,
				queue_complete_handler : queueComplete	// Queue plugin event
			};

			swfu = new SWFUpload(settings);
	     };
	</script>
{{ end }}
{{ block page }}
<div id="page">
    <form id="form1" action="" method="post" enctype="multipart/form-data">
        <p></p>
        {{ if albums.count(): }}
            <div id="div_selectphoto">{{=_("Select Album") }}: <select id="albumsSelect">
            {{ for album in albums: }}
            <option value="{{=album.name}}">{{=album.name}}{{ if not album.public: }}({{=_("private") }}){{ pass }}</option>
            {{ pass }}
            </select>
            </div>
            <div id="div_button">
                <span id="spanButtonPlaceHolder"></span>
                <input id="btnCancel" type="button" value="{{=_('Cancel All') }}" onclick="swfu.cancelQueue();" disabled="disabled" style="margin-left: 2px; font-size: 8pt; height: 29px;" />
            </div>
            <div id="divStatus"></div>
            <div style="clear: both;">&nbsp;</div>
            <div class="fieldset flash" id="fsUploadProgress">
            <span class="legend">{{=_('Photos Queue') }}</span>
            </div>
            <div id="upload_thumbs" class="fieldset flash">
            <span class="legend">{{=_('Thumbs') }}</span>
            <div id="upload_thumbs_container"></div>
            </div>
            
        {{ else: }}
            <a href="/admin/album/">{{=_('Create Album') }}</a>
        {{ pass }}
        <div style="clear: both;">&nbsp;</div>
    </form>
</div>
{{ end }}
